import java.util.ArrayList;


public class MyNode implements Comparable<MyNode>{
	int id;
	int age;
	boolean sex; // 1:male 2: female
	MyNode spouse;
	MyNode [] parent = new MyNode[2];
	ArrayList<Integer> childrenlist = new ArrayList<Integer>();
	boolean haveParent = false;
	public MyNode(int id, int age){
		this.id = id;
		this.age = age;
		this.sex = true;
	}
	public String toString(){
		return "V" + id +":age" + age+" sex:"+sex +"	\n";
	}
	
	public void YearlyUpdate(){
		age++;
		return;
	}
	public int getAge(){
		return this.age;
	}
	public void setAge(int age){
		this.age = age;
	}
	public void setSpouse(MyNode n){
		this.spouse = n;
	}
	public void setParent(MyNode n){
		
		if(!haveParent){
			this.parent[0] = n;
			haveParent = true;
		}else
			this.parent[1] = n; 
	}
	@Override
	public int compareTo(MyNode targetNode) {
		// TODO Auto-generated method stub
		return (this.age - targetNode.age);
	}
}
